This is a text
---
title: " "
output:
flexdashboard::flex_dashboard:
source_code: embed
theme: united
social: menu
css: style2.css
logo: logo.png
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning = FALSE
)
library(flexdashboard)
library(prettydoc)
library(readxl)
library(tidyverse)
library(crosstalk)
library(plotly)
library(viridis)
library(gsheet)
library(leaflet.providers)
library(leaflet)
library(DT)
library(cowplot)
```
```{r load data, message=FALSE, warning=FALSE, include=FALSE}
Sys.setlocale("LC_ALL", "pt_BR.UTF-8")
mg_prod <- gsheet2tbl("https://docs.google.com/spreadsheets/d/13xAflAQ-x78Vkq0O0jUEkUxHPq5G1R4gwqzillMxoTo/edit?usp=sharing")
wb1 <- gsheet2tbl("https://docs.google.com/spreadsheets/d/1x3KKDGIwdPQdG3YE5Ekn1iExMrqV76ndJbXAgLe7dsA/edit?usp=sharing")
wb_all <- wb1 %>%
filter(sample != 0) %>%
filter(region != "UNEMAT") %>%
mutate(id = case_when(
is.na(species) ~ "No",
TRUE ~ "Yes"
)) %>%
mutate(wheat = case_when(
host == "Triticum aestivum" ~ "Wheat",
TRUE ~ "Non-wheat"
)) %>%
dplyr::select(code, sample, lat, long, host, city, date, year, PstI_specie, species, wheat, DNA_extraction)
set.seed(1000)
wb_all$lat <- round(jitter(wb_all$lat, factor = 1, amount = 0.001), 4)
wb_all$long <- round(jitter(wb_all$long, factor = 1, amount = 0.001), 4)
```
```{r all table, echo=FALSE}
sd <- SharedData$new(wb_all)
```
Dashboard
============
Column {.sidebar}
-------------------------------------
### Quick filter
```{r}
filter_slider("year", "Select years", sd, ~year)
filter_checkbox("wheat", "Host group", sd, ~wheat, inline = TRUE)
filter_select("host", "Host name", sd, ~host)
filter_checkbox("DNA_extraction", "DNA extracted?", sd, ~DNA_extraction, inline = TRUE)
filter_select("PstI_specie", "Species ID", sd, ~PstI_specie)
```
Column {.tabset}
-------------------------------------
### Map strains
```{r}
library(RColorBrewer)
library(htmltools)
pal <- colorFactor("Set2", domain = c("Wheat", "Non-wheat"))
leaflet(data = sd, width = "100%") %>%
setView(-46.8, -20.40, zoom = 6) %>%
addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
addProviderTiles("OpenTopoMap", group = "Terrain") %>%
addScaleBar("bottomright") %>%
addProviderTiles(providers$CartoDB.Voyager, group = "Default") %>%
addLayersControl(
baseGroups = c("Default", "Aerial", "Terrain"),
overlayGroups = "Blast pathogen",
options = layersControlOptions(collapsed = T)
) %>%
addCircleMarkers(
group = "wheat",
radius = 6,
fillOpacity = 1,
weight = 0.5,
label = paste(wb_all$host, "- Details"),
fillColor = ~ pal(wheat),
popup = paste(
"Isolate details
",
"Code:", wb_all$"code", "
",
"Field sample:", wb_all$"sample", "
",
"Host:", wb_all$"host", "", "
",
"Tissue:", wb_all$"tissue", "
",
"Field sample:", wb_all$"sample", "
",
"City:", wb_all$"city", "
",
"Year:", wb_all$"year", "
",
"DNA extraction:", wb_all$"DNA_extraction", "
",
"Species:", wb_all$"PstI_specie", "
",
"OBS:", wb_all$"observation", "", "
"
)
) %>%
addLegend("bottomleft",
pal = pal,
values = ~wheat,
title = "Host",
opacity = 1
) %>%
addMeasure(
position = "bottomleft",
primaryLengthUnit = "meters",
primaryAreaUnit = "sqmeters",
activeColor = "#3D535D",
completedColor = "#7D4479") %>%
addEasyButton(easyButton(
icon="fa-globe", title="Zoom to Level 3",
onClick=JS("function(btn, map){ map.setZoom(3); }")))
```
### View grid display
```{r}
datatable(sd,
extensions = c("Buttons", "ColReorder"),
escape = TRUE, rownames = FALSE,
class = "cell-border stripe",
options = list(
dom = "Bfrtip", buttons = c("excel", "pdf"), deferRender = TRUE,
scrollY = 50,
pageLength = 15,
scroller = TRUE,
colReorder = TRUE
)
)
```
About the project
============
Column {.sidebar}
-------------------------------------
### Participants
Column {.tabset}
-------------------------------------
### About
This is a text
### How to use it